home *** CD-ROM | disk | FTP | other *** search
/ Magnum One / Magnum One (Mid-American Digital) (Disc Manufacturing).iso / d18 / vis082s.arc / FILEDIT.PAS < prev    next >
Pascal/Delphi Source File  |  1991-04-17  |  9KB  |  343 lines

  1. Uses Dos,Crt,gentypes;
  2. Label 1,2;
  3. Type
  4.      lstr=string[80];
  5.      mstr=string[35];
  6.      sstr=string[15];
  7.      Str2=String[2];
  8.  
  9.  
  10. Var Infile:File of udrec;
  11.     Area:Str2;
  12.     Recs:udrec;
  13.     Fsize  :Longint;
  14.     Inf2:file;
  15.     FileNum:Integer;
  16.     Num,a,b,c,d,e:Integer;
  17.     Flag,Flag2:Boolean;
  18.     Command,C2,Answer:Char;
  19.     Counter:Integer;
  20.     Spec1:String;
  21.     Specfile:File;
  22.  
  23.   Procedure Erase_Disk_File;
  24.     begin
  25.       Spec1:=recs.path+Recs.filename;
  26.       Assign(Specfile,spec1);
  27.       Erase(Specfile);
  28.     End;
  29.  
  30.   Procedure Delete_File;
  31.     Begin
  32.      If Filenum=Counter-1 then begin
  33.         Seek(Infile,filenum);
  34.         Truncate(Infile);
  35.      End Else Begin
  36.      For A:=1 to Counter-1 do Begin
  37.       seek(Infile,a);
  38.       read(Infile,recs);
  39.       seek(Infile,a-1);
  40.       write(Infile,Recs)
  41.     end;
  42.     seek (Infile,counter-1);
  43.     truncate (Infile);
  44.     End;
  45.     Close(Infile);
  46.   end;
  47.  
  48.   Procedure Add_File;
  49.    Begin
  50.     GotoXy(40,12);Write('File Number: ',Counter);
  51.     With Recs do
  52.     Begin
  53.       Gotoxy(23,13);Readln(filename);
  54.       Gotoxy(23,14);Readln(path);
  55.       Gotoxy(23,15);Readln(points);
  56.       Gotoxy(23,16);Readln(sentby);
  57.       Gotoxy(23,17);Readln(pass);
  58.       Gotoxy(23,18);Readln(downloaded);
  59.       Gotoxy(23,19);Write('FALSE');
  60.       Newfile:=False;
  61.       Gotoxy(23,20);Write('FALSE');
  62.       Specialfile:=False;
  63.       Gotoxy(23,21);Readln(descrip);
  64.       Gotoxy(23,22);Readln(sendto);
  65.       Assign(Inf2,Path+Filename);
  66.       Reset(inf2);
  67.     End;
  68.     Fsize:=Filesize(Inf2);
  69.     Close(Inf2);
  70.     Seek(Infile,Counter);
  71.     Write(Infile,Recs);
  72.    End;
  73.  
  74.   Procedure Format_Data_Area;
  75.     Begin
  76.      For A:=13 to 24 do begin
  77.          GotoXy(23,A);Write('                                                     ');
  78.          End;
  79.     End;
  80.  
  81.   Procedure Commands;
  82.     Begin
  83.       TextColor(14);
  84.       Gotoxy(5,5);
  85.       Writeln('[A] Change Name     [B] Change Path          [C] Change Points');
  86.       Gotoxy(5,6);
  87.       Writeln('[D] Sent By         [E] DL Password          [F] Times DL''ed');
  88.       Gotoxy(5,7);
  89.       Writeln('[G] New File Rating [H] Special File Rating  [I] Description');
  90.       Gotoxy(5,8);
  91.       Writeln('[J] Send file to    [K] Delete File          [L] Add File');
  92.       TextColor(12);
  93.       Writeln('                   [Page Up & Page Down] Change Area');
  94.       Writeln('       [Uarrow] Next File                     [Darrow] Next File');
  95.       TextColor(11);
  96.       Gotoxy(53,12);Write('   ');
  97.       GotoXy(40,12);Write('File Number: ',Filenum);
  98.       Gotoxy(62,12);Writeln('[Q] Quit & Save');
  99.     end;
  100.  
  101.   Procedure Write_Area;
  102.     Begin
  103.       Seek(Infile,Filenum);
  104.       Write(Infile,Recs);
  105.       If Flag=TRUE then Begin
  106.         Close(Infile);
  107.         clrscr;
  108.         textcolor(15);
  109.         writeln('ViSiON BBS File Editor Ver 1.00 Written by Ken Sallot for ViSiON BBS Systems');
  110.         gotoxy(25,23);
  111.         writeln('Thanks for using ViSiON!');
  112.       End;
  113.       If Flag2=TRUE then Begin
  114.         Close(Infile);
  115.       End;
  116.     end;
  117.  
  118.   Procedure Open_Area(Area:Str2);
  119.     Begin
  120.       Assign(Infile,'AREA'+Area);
  121.       Reset(Infile);
  122.       Counter:=0;
  123.       While not eof (Infile) do Begin
  124.         Read(Infile,recs);
  125.         Counter:=Counter+1;
  126.         Filenum:=0;
  127.       end;
  128.     end;
  129.  
  130.   Procedure Next_File;
  131.    Begin
  132.     Filenum:=Filenum+1;
  133.     If filenum>counter then filenum:=0;
  134.    End;
  135.  
  136.   Procedure List_Data;
  137.     Begin
  138.     Gotoxy(1,13);
  139.      TextColor(4);
  140.      If FileNum>=Counter then Filenum:=0;
  141.      If Filenum<0 then filenum:=Counter-1;
  142.      Seek(infile,Filenum);
  143.      Read(Infile,Recs);
  144.      With recs do Begin
  145.        Writeln('File Name           : ',Filename);
  146.        Writeln('File Path           : ',Path);
  147.        Writeln('File Points         : ',Points);
  148.        Writeln('Sent By             : ',sentby);
  149.        Writeln('Password            : ',pass);
  150.        Writeln('Downloded           : ',Downloaded,' Times');
  151.        Writeln('New File Rating     : ',Newfile);
  152.        Writeln('Special Rating      : ',Specialfile);
  153.        Writeln('Description         : ',descrip);
  154.        Writeln('Send file to        : ',sendto);
  155.      End;
  156.     End;
  157.  
  158.  
  159.   Begin
  160. 1: ClrScr;
  161.    TextColor(13);
  162.    Gotoxy(24,2);
  163.    Write('ViZ File Editor v1.00 ViZ Staff');
  164.    TextColor(14);
  165.     For a:=1 to 79 do
  166.      Begin
  167.        Gotoxy(a,3);
  168.        Write('─');
  169.      end;
  170.     For a:=1 to 79 do
  171.      Begin
  172.        Gotoxy(a,1);
  173.        Write('─');
  174.      end;
  175.    TextColor(9);
  176.    For a:=1 to 79 do
  177.      Begin
  178.        Gotoxy(a,4);
  179.        Write('─');
  180.      end;
  181.     For a:=1 to 79 do
  182.      Begin
  183.        Gotoxy(a,11);
  184.        Write('─');
  185.      end;
  186.    Writeln;
  187.    Flag2:=False;
  188.    Flag:=False;
  189.    a:=0;
  190.    Filenum:=0;
  191.    Num:=0;
  192.    Counter:=0;
  193.    C2:='+';
  194.    Command:='+';
  195.    TextColor(11);
  196.    Gotoxy(1,12);
  197.    Write('Area Number: ');
  198.    TextColor(10);
  199.    Readln(area);
  200. 2: TextColor(4);
  201.    Open_Area(Area);
  202.    List_Data;
  203.    Commands;
  204.    Repeat
  205.    GotoXY(1,1);
  206.    Command:=Readkey;
  207.    Command:=Upcase(Command);
  208.    Case Command of
  209.    'A':Begin
  210.          Gotoxy(23,13);
  211.          For a:=1 to 50 do Write(' ');
  212.          Gotoxy(23,13);
  213.          Readln(recs.filename);
  214.        End;
  215.    'B':Begin
  216.          Gotoxy(23,14);
  217.          For a:=1 to 50 do Write(' ');
  218.          Gotoxy(23,14);
  219.          Readln(recs.path);
  220.        End;
  221.  
  222.    'C':Begin
  223.          Gotoxy(23,15);
  224.          For a:=1 to 50 do Write(' ');
  225.          Gotoxy(23,15);
  226.          Readln(recs.points);
  227.        End;
  228.  
  229.    'D':Begin
  230.          Gotoxy(23,16);
  231.          For a:=1 to 50 do Write(' ');
  232.          Gotoxy(23,16);
  233.          Readln(recs.sentby);
  234.        End;
  235.  
  236.    'E':Begin
  237.          Gotoxy(23,17);
  238.          For a:=1 to 50 do Write(' ');
  239.          Gotoxy(23,17);
  240.          Readln(recs.pass);
  241.        End;
  242.  
  243.    'F':Begin
  244.          Gotoxy(23,18);
  245.          For a:=1 to 50 do Write(' ');
  246.          Gotoxy(23,18);
  247.          Readln(recs.downloaded);
  248.        End;
  249.  
  250.    'G':Begin
  251.          Gotoxy(23,19);
  252.          For a:=1 to 50 do Write(' ');
  253.          Gotoxy(23,19);
  254.          If Recs.Newfile=TRUE then Recs.Newfile:=False else
  255.          If Recs.Newfile=False then Recs.Newfile:=True;
  256.          Write_Area;
  257.          List_Data;
  258.        End;
  259.    'H':Begin
  260.          Gotoxy(23,20);
  261.          For a:=1 to 50 do Write(' ');
  262.          Gotoxy(23,20);
  263.          If Recs.specialfile=TRUE then Recs.specialfile:=False else
  264.          If Recs.specialfile=False then recs.specialfile:=True;
  265.          Write_Area;
  266.          List_Data;
  267.        End;
  268.    'I':Begin
  269.          Gotoxy(23,21);
  270.          For a:=1 to 50 do Write(' ');
  271.          Gotoxy(23,21);
  272.          Readln(recs.descrip);
  273.        End;
  274.    'J':Begin
  275.          Gotoxy(23,22);
  276.          For a:=1 to 50 do Write(' ');
  277.          Gotoxy(23,22);
  278.          Readln(recs.sendto);
  279.        End;
  280.    'Q':Begin
  281.          Flag:=True;
  282.          Write_Area;
  283.        End;
  284.  
  285.      'K':Begin
  286.            GotoXy(1,24);Write('                     ');
  287.            Gotoxy(1,24);Write('Erase this file from the disk? ');
  288.            Answer:=Readkey;
  289.            Answer:=Upcase(Answer);
  290.            If Answer='Y' then Erase_Disk_File;
  291.            Gotoxy(1,24);
  292.            Write('Delete this file from area list? ');
  293.            Answer:=Readkey;
  294.            Answer:=Upcase(Answer);
  295.            If Answer='Y' then Delete_file Else Begin
  296.            GotoXy(1,24);Write('                                ');
  297.            End;
  298.            Goto 2;
  299.          End;
  300.  
  301.      'L':Begin
  302.            Write_Area;
  303.            Format_Data_Area;
  304.            Add_File;
  305.            Close(Infile);
  306.            Format_Data_Area;
  307.            Goto 2;
  308.          End;
  309.  
  310.      #0:Begin
  311.          C2:=Readkey;
  312.          Case C2 of
  313.            #72:Begin
  314.                  Write_Area;
  315.                  FileNum:=FileNum+1;
  316.                  Format_Data_Area;
  317.                  list_Data;
  318.                  Commands;
  319.                End;
  320.  
  321.            #80:Begin
  322.                  Write_Area;
  323.                  FileNum:=FileNum-1;
  324.                  Format_Data_Area;
  325.                  list_Data;
  326.                  Commands;
  327.                End;
  328.  
  329.            #73:Begin
  330.                  Flag2:=True;
  331.                  Write_Area;
  332.                  Goto 1;
  333.                  End;
  334.            #81:Begin
  335.                  Flag2:=True;
  336.                  Write_Area;
  337.                  Goto 1;
  338.                  End;
  339.            End;
  340.    End;
  341.    End;
  342.    Until Flag=True;
  343.   end.